package com.yiqi.zhiyuan.feature.certification.view.adapter;

import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.suozhang.framework.framework.AM;
import com.yiqi.zhiyuan.R;
import com.yiqi.zhiyuan.entity.bo.UploadCertificatesInfo;

/**
 * @ProjectName: ZhiYuan
 * @Package: com.yiqi.zhiyuan.feature.login.view.adapter
 * @ClassName: UploadCertificatesAdapter
 * @Description: 上传证件Adapter
 * @Author:
 * @CreateDate: 2019/3/12 10:27
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/3/12 10:27
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class UploadCertificatesAdapter extends BaseQuickAdapter<UploadCertificatesInfo, BaseViewHolder> {

    public UploadCertificatesAdapter() {
        super(R.layout.item_upload_certificates);
    }

    @Override
    protected void convert(BaseViewHolder helper, UploadCertificatesInfo item) {
        if (!TextUtils.isEmpty(item.getImgUrl())) {
            helper.getView(R.id.img_upload_cover).setWillNotDraw(false);
            AM.image().bind(item.getImgUrl(), helper.getView(R.id.img_upload_cover));
        }else {
            helper.getView(R.id.img_upload_cover).setWillNotDraw(true);
        }
        helper.setText(R.id.tv_upload_content, item.getContent())
                .addOnClickListener(R.id.btn_image_del)
                .setVisible(R.id.btn_image_del, !TextUtils.isEmpty(item.getImgUrl()));
    }
}
